import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router';
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index';
import Home from '@/views/home';
import Login from '@/views/login';
import NotFound from '@/views/404';
import UpdatePassword from '@/views/update-password';
import pay from '@/views/pay';
import register from '@/views/register';
import forgoPw from '@/views/forgoPw';
import center from '@/views/center';
import chuanchengrengushi from '@/views/modules/chuanchengrengushi/list';
import zhuanjia from '@/views/modules/zhuanjia/list';
import shangpinxinxi from '@/views/modules/shangpinxinxi/list';
import shangpinzhekou from '@/views/modules/shangpinzhekou/list';

import shangpinfenlei from '@/views/modules/shangpinfenlei/list';

import discussshouyizhizuo from '@/views/modules/discussshouyizhizuo/list';
import storeup from '@/views/modules/storeup/list';
import shouyizhizuo from '@/views/modules/shouyizhizuo/list';
import gujianzhu from '@/views/modules/gujianzhu/list';
import systemintro from '@/views/modules/systemintro/list';
import yonghu from '@/views/modules/yonghu/list';
import chuantongyishuzhan from '@/views/modules/chuantongyishuzhan/list';
import canjiazhizuo from '@/views/modules/canjiazhizuo/list';
import chuantongfenlei from '@/views/modules/chuantongfenlei/list';
import news from '@/views/modules/news/list';
import aboutus from '@/views/modules/aboutus/list';
import discussgujianzhu from '@/views/modules/discussgujianzhu/list';
import discusschuantongwenhua from '@/views/modules/discusschuantongwenhua/list';
import yipinleixing from '@/views/modules/yipinleixing/list';
import discusswenxuezuopin from '@/views/modules/discusswenxuezuopin/list';
import wenxuezuopin from '@/views/modules/wenxuezuopin/list';
import chuantongyinle from '@/views/modules/chuantongyinle/list';
import forum from '@/views/modules/forum/list';
import forumType from '@/views/modules/forum/type/list';
import chuantongwenhua from '@/views/modules/chuantongwenhua/list';
import zuopinfenlei from '@/views/modules/zuopinfenlei/list';
import wenwujianding from '@/views/modules/wenwujianding/list';
import discussshangpinxinxi from '@/views/modules/discussshangpinxinxi/list';
import orders from '@/views/modules/orders/list';
import chuantongwenhuajigou from '@/views/modules/chuantongwenhuajigou/list';
import config from '@/views/modules/config/list';
import chuantongfushizhan from '@/views/modules/chuantongfushizhan/list';
import newstype from '@/views/modules/newstype/list';

import scenicSpot from '@/views/modules/scenicSpot/list';

import discussForum from '@/views/modules/discussForum/list';

//2.配置路由   注意：名字
export const routes = [
  {
    path: '/',
    name: '系统首页',
    component: Index,
    children: [
      {
        // 这里不设置值，是把main作为默认页面
        path: '/',
        name: '系统首页',
        component: Home,
        meta: { icon: '', title: 'center', affix: true },
      },
      {
        path: '/discussForum',
        name: '论坛评价列表',
        component: discussForum,
        meta: { icon: '', title: 'discussForum' },
      },
      {
        path: '/scenicSpot',
        name: '旅游景点',
        component: scenicSpot,
        meta: { icon: '', title: 'scenicSpot' },
      },
      {
        path: '/updatePassword',
        name: '修改密码',
        component: UpdatePassword,
        meta: { icon: '', title: 'updatePassword' },
      },
      {
        path: '/pay',
        name: '支付',
        component: pay,
        meta: { icon: '', title: 'pay' },
      },
      {
        path: '/center',
        name: '个人信息',
        component: center,
        meta: { icon: '', title: 'center' },
      },
      {
        path: '/chuanchengrengushi',
        name: '传承人故事',
        component: chuanchengrengushi,
      },
      {
        path: '/merchant',
        name: '商家',
        component: zhuanjia,
      },
      {
        path: '/shangpinxinxi',
        name: '商品信息',
        component: shangpinxinxi,
      },
      {
        path: '/shangpinzhekou',
        name: '折扣商品',
        component: shangpinzhekou,
      },
      {
        path: '/shangpinfenlei',
        name: '商品分类',
        component: shangpinfenlei,
      },
      {
        path: '/discussshouyizhizuo',
        name: '手艺制作评论',
        component: discussshouyizhizuo,
      },
      {
        path: '/storeup',
        name: '我的收藏',
        component: storeup,
      },
      {
        path: '/shouyizhizuo',
        name: '手艺制作',
        component: shouyizhizuo,
      },
      {
        path: '/gujianzhu',
        name: '古建筑',
        component: gujianzhu,
      },
      {
        path: '/systemintro',
        name: '系统简介',
        component: systemintro,
      },
      {
        path: '/yonghu',
        name: '用户',
        component: yonghu,
      },
      {
        path: '/chuantongyishuzhan',
        name: '传统艺术展',
        component: chuantongyishuzhan,
      },
      {
        path: '/canjiazhizuo',
        name: '参加制作',
        component: canjiazhizuo,
      },
      {
        path: '/chuantongfenlei',
        name: '传统分类',
        component: chuantongfenlei,
      },
      {
        path: '/news',
        name: '公告信息',
        component: news,
      },
      {
        path: '/aboutus',
        name: '关于我们',
        component: aboutus,
      },
      {
        path: '/discussgujianzhu',
        name: '古建筑评论',
        component: discussgujianzhu,
      },
      {
        path: '/discusschuantongwenhua',
        name: '传统文化评论',
        component: discusschuantongwenhua,
      },
      {
        path: '/yipinleixing',
        name: '艺品类型',
        component: yipinleixing,
      },
      {
        path: '/discusswenxuezuopin',
        name: '文学作品评论',
        component: discusswenxuezuopin,
      },
      {
        path: '/wenxuezuopin',
        name: '文学作品',
        component: wenxuezuopin,
      },
      {
        path: '/chuantongyinle',
        name: '传统音乐',
        component: chuantongyinle,
      },
      {
        path: '/forum',
        name: '论坛管理',
        component: forum,
      },
      {
        path: '/forumType',
        name: '论坛板块',
        component: forumType,
      },
      {
        path: '/chuantongwenhua',
        name: '传统文化',
        component: chuantongwenhua,
      },
      {
        path: '/zuopinfenlei',
        name: '作品分类',
        component: zuopinfenlei,
      },
      {
        path: '/wenwujianding',
        name: '文物鉴定',
        component: wenwujianding,
      },
      {
        path: '/discussshangpinxinxi',
        name: '商品信息评论',
        component: discussshangpinxinxi,
      },
      {
        path: '/orders/:status',
        name: '订单管理',
        component: orders,
      },
      {
        path: '/chuantongwenhuajigou',
        name: '传统文化机构',
        component: chuantongwenhuajigou,
      },
      {
        path: '/config',
        name: '轮播图管理',
        component: config,
      },
      {
        path: '/chuantongfushizhan',
        name: '传统服饰展',
        component: chuantongfushizhan,
      },
      {
        path: '/newstype',
        name: '公告信息分类',
        component: newstype,
      },
    ],
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: { icon: '', title: 'login' },
  },
  {
    path: '/register',
    name: '注册',
    component: register,
    meta: { icon: '', title: 'register' },
  },
  {
    path: '/forgoPw',
    name: '忘记密码',
    component: forgoPw,
    meta: { icon: '', title: 'forgoPw' },
  },
  {
    path: '*',
    component: NotFound,
  },
];
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: 'hash',
  /*hash模式改为history*/
  routes, // （缩写）相当于 routes: routes
});
const originalPush = VueRouter.prototype.push;
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
export default router;
